<template>
	<view>
		<view v-for="(item,index) in list" :key="index" v-if="item.statusName=='隐患待整改'">
			<view style="width: 690rpx;border-radius: 12rpx;margin-left: 30rpx;background-color: #FFFFFF;margin-top: 24rpx;">
				<view style="color: #FFFFFF;width: 152rpx;height: 40rpx;background-image: linear-gradient(to right, #FF952C , #FFA940);
				border-top-left-radius:12rpx;border-bottom-right-radius:12rpx;font-size: 26rpx;text-align: center;line-height: 40rpx;" v-if="item.statusName=='隐患待整改'">隐患待整改</view>
				<view style="font-size: 34rpx;line-height: 34rpx;margin-top: 30rpx;margin-left: 40rpx;">{{item.name}}</view>
				<view v-for="(i,index) in item.item" :key="i">
					<view style="display: flex;" v-if="index==item.index[0]">
						<image src="../../static/icon_can@3x.png" style="width: 44rpx;height: 44rpx;margin-top: 40rpx;margin-left: 40rpx;"></image>
						<view style="font-size: 32rpx;line-height: 32rpx;margin-left: 26rpx;margin-top: 46rpx;color: #666666;">{{i}}</view>
					</view>
					<view style="display: flex;" v-else>
						<image src="../../static/btn_normal@3x.png" style="width: 44rpx;height: 44rpx;margin-top: 40rpx;margin-left: 40rpx;"></image>
						<view style="font-size: 32rpx;line-height: 32rpx;margin-left: 26rpx;margin-top: 46rpx;color: #666666;">{{i}}</view>
					</view>
				</view>	
				<view style="font-size: 28rpx;color: #666666;line-height: 28rpx;margin-left: 112rpx;margin-top: 34rpx;">巡查时间：{{item.answerTime}}</view>
				<view style="font-size: 28rpx;color: #666666;line-height: 28rpx;margin-left: 112rpx;margin-top: 20rpx;">巡查人：{{item.userName}}</view>
				<view style="width: 690rpx;height: 88rpx;box-shadow: 0 -6rpx 10rpx 0 rgba(0, 0, 0, 0.03);margin-top: 42rpx;display: flex;" v-if="item.statusName=='隐患待整改'">
					<image src="../../static/btn_takephoto_2@3x.png" style="width: 44rpx;height: 44rpx;margin-left: 256rpx;padding-top: 22rpx;" @click="gotoZG(item.id)"></image>
					<view style="color: #1372F5;font-size: 32rpx;line-height: 32rpx;padding-top: 26rpx;" @click="gotoZG(item.id)">立即整改</view>
				</view>
				<view v-else-if="item.statusName=='整改完成'">
					<view style="width: 690rpx;height: 1rpx;background-color: #E5E5E5;margin-top: 40rpx;"></view>
					<view style="font-size: 32rpx;line-height: 32rpx;margin-top: 38rpx;margin-left: 112rpx;">整改说明</view>
					<view style="color: #666666;font-size: 32rpx;line-height: 32rpx;margin-top: 20rpx;margin-left: 112rpx;">场所已恢复原状，已整改</view>
					<view style="font-size: 28rpx;line-height: 28rpx;margin-top: 40rpx;margin-left: 112rpx;color: #666666;">整改时间：{{item.createTime}}</view>
					<view style="font-size: 28rpx;line-height: 28rpx;margin-top: 20rpx;margin-left: 112rpx;color: #666666;">整改人：张建立</view>
				</view>	
			</view>
		</view>
		<image src="../../static/img_k@3x.png" style="width: 362rpx;height: 360rpx;margin-top: 190rpx;margin-left: 208rpx;" v-if="num === 0 && (isLoadMore=='noMore')"></image>
		<view v-else>
			<view v-show="isLoadMore" style="margin-bottom: 30rpx;">
				<uni-load-more :status="isLoadMore" :contentText="contentText" showText="false" @clickLoadMore="loadmore()"></uni-load-more>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				name:'',
				ownerId:'',
				list:[],
				page:1,
				isLoadMore:'more',
				contentText:{contentdown: "查看更多",contentrefresh: "正在加载...",contentnomore: "没有更多数据了"},		
				num:0,
			}
		},
		methods: {
			radioChange(e) {
				console.log(e);
			},
			gotoZG(id){
				uni.navigateTo({
					url:`./ZGxiangQ?id=${id}&ownerId=${this.ownerId}`
				})
			},
			async getName(){
				this.$myRequest({
					url:'/project_flood/v1/check/risk/page',
					data:{"pageNum":this.page,"pageSize":100,"ownerId":this.ownerId,"statusList":[1,2]}
				}).then((res)=>{
					console.log(res);
					this.list=res.data.data.list
					console.log(this.list);
					if(this.list.length<res.data.data.total)
						{
							this.isLoadMore='more'
						}
					else
						{
							this.isLoadMore='noMore'
						}
					this.list.map(e=>{
						console.log(e);
						if(e.statusName=='隐患待整改')
						{
							this.num++
						}
					})
				})
			},
			loadmore(){
				if(this.isLoadMore !== 'more') return
				this.page=this.page+1
				this.$myRequest({
					url: '/project_flood/v1/check/risk/page',
					data: {"pageNum":this.page,"pageSize":100,"ownerId":this.ownerId,"statusList":[1,2]},
				}).then((res)=>{
					console.log(res);
					this.list=this.list.concat(res.data.data.list)
					if(this.list.length<res.data.data.total)
						{
							this.isLoadMore='more'
						}
					else
						{
							this.isLoadMore='noMore'
						}
						this.list.map(e=>{
							console.log(e);
							if(e.statusName=='隐患待整改')
							{
								this.num++
							}
						})
				})
			},
		},
		onLoad(options) {
			this.ownerId=options.id
			
			
		},
		onShow() {
			this.getName()
			
		}
	}
</script>

<style>
page{background-color: #F5F5F8;}
.lable{
	display: flex;
	margin-top: 50rpx;
	margin-left: 40rpx;
}
</style>
